import { useEffect, useState } from "react";
import { ClockCircleOutlined, MinusCircleFilled, UserOutlined } from "@ant-design/icons";
import { Avatar, Badge, Button, Drawer, Space, Steps, Table, Tag } from "antd";
import { getHistoryList } from "./service";
import { badgeItem, columns, renderFlagFn } from "./consts";

interface Props {
  instanceId: string;
}

const ProcessHistory = (props: Props) => {
  const [dataList, setDataList] = useState<any[]>([]);
  const _getHistoryList = async (instanceId: string) => {
    const res = await getHistoryList(instanceId);
    setDataList(res.data)
  }
  useEffect(() => {
    if (props.instanceId) {
      _getHistoryList(props.instanceId);
    }
  }, [props.instanceId])

  return (
    <Table
      style={{width: "100%"}}
      dataSource={dataList}
      columns={columns}
    />
  )
}

export default ProcessHistory;
